GEMDOS Calls unique to MiNT

#include mintbind.h>

long Dclosedir(long dir); Close directory whose handle is dir.

LONG Dcntl(word command, char &sstarf#star;fdname, long argument); Perform a file system specific command upon file or directory fdname. argument depends on command.

int Dlock(short mode, short drive); Lock (mode = = 1) or unlock (mode = = 0) the BIOS device drive.

long Dopendir(char &sstarf#star;dname, word flag); Open directory dname for reading and return a handle. falg determines mode (flag = = 0 for ``normal'', flag = = 1 for ``compatibility'' mode).

LONG Dpathconf(char &sstarf#star;name, WORD which); Return information about various limits/capabilities of the file system on which file name is located. The information returned depends upon which as follows:

ValueMeaning


-1max. legal value for which 0int. limit of open files 1max. # of links to a file 2max. len. of a full pathname 3max. len. of an individuell file name 4# of bytes written atomically 5info about file name truncation

LONG Dreaddir(word buflen, LONG dirhandle, char &sstarf#star;buf); Return next entry from directory assosiated with dirhandle in buffer buf with length buflen.

LONG Drewinddir(LONG dirhandle); Rewinds the open directory assosiated with dirhandle.

LONG Fchmod(char &sstarf#star;fname, WORD mode); The file access permissions of fname are changed according to mode.

LONG Fchown(char &sstarf#star;fname, WORD uid, WORD gid); The user and group ownership of fname are set to uid and gid respectivly. (TOS file system doesn't support a notion of ownership.

WORD Fcntl(WORD fh, LONG arg, WORD cmd); Do file control commands on file handle fh of an open file. cmd and arg vary upon the file type of fh and the operation.

LONG Fgetchar(WORD fh, WORD mode); Read a character from the file assosiated with handle fh. mode determines mode (cooked, raw, echo).

LONG Finstat(WORD fh); Return the number of characters available for reading from file handle fh.

LONG Flink(char &sstarf#star;oldname, char &sstarf#star;newname); The file name newname (a ``hard link'') for the file currently named oldname is created. (The TOS file system doesn't support links.)

LONG Fmidipipe(WORD pid, WORD in, WORD out); Changes the GEMDOS Midi input and output handles for process with id pid to in and out .

LONG Foutstat(WORD fh); Return the number of bytes, that may be written to file handle fh without blocking.

WORD Fpipe(WORD usrh[2]); Create a pipe. usrh[0] is the read-only end and usrh[1] the write-only end file handle of the pipe.

LONG Fputchar(WORD fh, LONG ch, WORD mode); Write a character to the file whose handle is fh. mode is as for Fgetchar.

LONG Freadlink(WORD bufsiz, char *buf, char *lname); Returns in the buffer buf of size bufsiz the file name the symbolic link lname points to. (The TOS file system doesn't support symbolic links.)

WORD Fselect(unsigned WORD timeout, LONG &sstarf#star;rfds, LONG &sstarf#star;wfds, ((long) 0)); Select file descriptors, that are ready for reading or writing. timeout is the number of milliseconds to wait before returning. A bit in one of the [rw]fds bitmaps, which is on, indicates the file descriptor to be tested.

LONG Fsymlink(char &sstarf#star;oldname, char &sstarf#star;newname); The file name newname (a ``soft link'') for the file currently named oldname is created. (The TOS file system doesn't support symbolic links.)

LONG Fxattr(WORD flag, char &sstarf#star;fname, XATTR &sstarf#star;xattr); For the file fname, the file attributes are obtained and stored in xattr. If flag = = 0 a symbolic link is resolved, otherwise (flag = = 1) the info is for the symbolic link itself.

void Pause(); Suspend the process until it receives a signal that is not being ignored and is not masked.

WORD Pdomain(WORD newdom); If newdom is not -1, sets the process domain of the current process to newdom. Alway returns previous domain. Domain 0 is the TOS domain and the default; domain 1 is the MiNT domain.

LONG Pfork(); Create a new process, that is the duplicate of the current one, but has its own copy of the address space. The return value is 0 for the child, and the child's pid in the parent.

WORD Pgetegid(); WORD Pgeteuid(); Return the effective groud or user id's.

WORD Pgetgid(); WORD Psetgid(WORD id); Get or set the group id of the current process.

WORD Pgetpid(); WORD Pgetppid(); WORD Pgetpgrp(); Get the currents process' process id, it's parent's process id, or its process group.

WORD Pgetuid(); WORD Psetuid(WORD id); Return or set the user id under which the current process is running.

WORD Pkill(WORD pid, WORD sig); Send signal sig to process with given pid. If pid= = 0, the signal is sent to all proc's with the same process group.

LONG Pmsg(WORD mode, LONG mbox, void &sstarf#star;msg);

WORD Pnice(WORD delta);

WORD Prenice( word pid, word delta);

void Prusage(LONG rsp[8]); Get various resource information from the operating system.

ValueMeaning


r[0]time spent in MiNT kernel r[1]time spent in proc's own code r[2]tot. kernel time for children r[3]tot. user code time for children r[4]memory alloc. for this proc. r[5]-r[7]reserved

Psemaphore(short mode, long id, long tmout);

LONG Psetlimit(WORD lim, LONG val); Get/Set a resource limit for a process. The old limit is returned. If val is negativ, the limit is unchanged; 0 sets umlimited resource; any other value sets that limit. lim is defined as follows:

ValueMeaning


1max. CPU for proc in milliseconds 2max. memory allowed for proc. 3limit of Malloc()'ed mem. for proc.

Psigaction(short sig, long action, long oldaction);

WORD Psetpgrp(WORD pid, WORD newgrp); Set the process group of the process with given pid to newgrp.

LONG Psigblock(unsigned LONG mask); Adds the signal in the 32 bit mask to the blocked set. The return value is the set of previously blocked signals. (Usage: Psigblock(1 < < SIG#))

LONG Psignal(WORD signal, (void)(&sstarf#star;handler)(LONG sig); Installs a signal handler for the indicated signal. handler is the address of a function, that will be called, when the signal occurs.

LONG Psigpending(); Return a longword containing the signals, that have been sent to the process, but not yet handled.

LONG Psigreturn(); Prepare to exit from a signal handler. (only needed with longjmp())

LONG Psigsetmask(unsigned LONG mask); Replaces the set of blocked signals with mask. The old set of blocked signals is returned.

Pumask(short mask);

LONG Pusrval(LONG arg); Return the process specific user value for this process.

WORD Pvfork(); Creates a copy of the current process. Both child and parent share the same address space. The return value is 0 for the child, and the child's pid in the parent.

LONG Pwait(); Return the exit status of the children run asyncronously.

LONG Pwait3(WORD flag, LONG &sstarf#star;rusage); Wait for a child and return its exit status. If rusage is non zero, rusage[0] contains millisec's spend by child in user space and rusage[1] contains millisec's spent by child in kernel space.

WORD Syield(); Tell MiNT, that is okay to switch processes right now. Always returns 0.

LONG Sysconf(WORD n); Return information about various limits/capabilities of the current version of MiNT. Possible values for n are:

ValueMeaning


-1max. legal value for n 0max. # of mem. regions per proc. 1max. len. of Pexec command line 2max. # of open files per proc. 3# of suppl. group id's 4# of procs per user

LONG Talarm(LONG sec); Set an alarm to go off sec from now. If sec= =0 cancel any pending alarm.